/** 
* @Title: DemoTest.java
* @Package: org.renne.bankValidation
* @Description: TODO(银行卡验证测试类)
* @author:kevin
* @date:2017年8月4日 上午10:23:34
* @version:V1.0 
*/
package cardval;

import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

import utils.HttpPostMap;
import utils.MD5;

public class CardUtils {
	private static final String SERVER_URL = "http://139.196.19.100:8080/cardval/validationCard";
	
	public static String cardval(String pKey, String partnerCode, String cardNo,  String cardName,
			String cardMobile, String cardIdtype, String cardIdcard, String serialNo)  {
		//分配商户的key//合作商编号//请输入帐号卡号//姓名//号码//类型//身份证 //流水号  
	     Map<String, String> params = new HashMap<String, String>();
			params.put("PARTNERNO", partnerCode);
			params.put("CARDNO", cardNo);
			params.put("PKEY", pKey);
			//params.put("SIGN", sign);
			params.put("CARDNAME", cardName);//姓名
			params.put("CARDMOBILE", cardMobile);//手机号
	        params.put("CARDIDTYPE", cardIdtype);
	        params.put("CARDIDCARD", cardIdcard);//身份证号码
	        params.put("SERIALNO",serialNo);
	       
	        String txt = pKey + "|" + partnerCode + "|" + serialNo + "|" + cardNo + "|"
	                + cardMobile + "|" + cardIdcard + "|" + cardName + "|" + cardIdtype;
	        params.put("SIGN", MD5.encode(txt));
	        //System.out.println("签名值是："+params.get("SIGN"));
	        String ret = "";
			try {
				ret = HttpPostMap.post(SERVER_URL, params, 1);
				 return ret;
			} catch (KeyManagementException | NoSuchAlgorithmException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

	}
	
	
		


}
